<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Filter::Util::Call - Perl Source Filter Utility Module - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/Filter::Util::Call">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Filter::Util::Call.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/Filter::Util::Call">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/Filter::Util::Call">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/Filter::Util::Call">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/Filter::Util::Call">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/Filter::Util::Call">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/Filter::Util::Call">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/Filter::Util::Call">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/Filter::Util::Call">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/Filter::Util::Call">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/Filter::Util::Call">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/Filter::Util::Call">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/Filter::Util::Call">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/Filter::Util::Call">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/Filter::Util::Call">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/Filter::Util::Call">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/Filter::Util::Call">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/Filter::Util::Call">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/Filter::Util::Call">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/Filter::Util::Call">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/Filter::Util::Call">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/Filter::Util::Call">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/Filter::Util::Call">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/Filter::Util::Call">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/Filter::Util::Call">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/Filter::Util::Call">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/Filter::Util::Call">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/Filter::Util::Call">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/Filter::Util::Call">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/Filter::Util::Call">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/Filter::Util::Call">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/Filter::Util::Call">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/Filter::Util::Call">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/Filter::Util::Call">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/Filter::Util::Call">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/Filter::Util::Call">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/Filter::Util::Call">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/Filter::Util::Call">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/Filter::Util::Call">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/Filter::Util::Call">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/Filter::Util::Call">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/Filter::Util::Call">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/Filter::Util::Call">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/Filter::Util::Call">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/Filter::Util::Call">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/Filter::Util::Call">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/Filter::Util::Call">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/Filter::Util::Call">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/Filter::Util::Call">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/Filter::Util::Call">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/Filter::Util::Call">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/Filter::Util::Call">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/Filter::Util::Call">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/Filter::Util::Call">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/Filter::Util::Call">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/Filter::Util::Call">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/Filter::Util::Call">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/Filter::Util::Call">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/Filter::Util::Call">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/Filter::Util::Call">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/Filter::Util::Call">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/Filter::Util::Call">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/Filter::Util::Call">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/Filter::Util::Call">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/Filter::Util::Call">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/Filter::Util::Call">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/Filter::Util::Call">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/Filter::Util::Call">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/Filter::Util::Call">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/Filter::Util::Call">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/Filter::Util::Call">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/Filter::Util::Call">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/Filter::Util::Call">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/Filter::Util::Call">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/Filter::Util::Call">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/Filter::Util::Call">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/Filter::Util::Call">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/Filter::Util::Call">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/Filter::Util::Call">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/Filter::Util::Call">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/Filter::Util::Call">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Filter::Util::Call.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/Filter::Util::Call">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/Filter::Util::Call">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/Filter::Util::Call">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/Filter::Util::Call">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/Filter::Util::Call">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/Filter::Util::Call">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/Filter::Util::Call">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/Filter::Util::Call">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/Filter::Util::Call">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/Filter::Util::Call">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/Filter::Util::Call">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/Filter::Util::Call">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/Filter::Util::Call">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/Filter::Util::Call">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/Filter::Util::Call">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/Filter::Util::Call">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/Filter::Util::Call">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/Filter::Util::Call">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/Filter::Util::Call">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/Filter::Util::Call">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/Filter::Util::Call">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/Filter::Util::Call">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/Filter::Util::Call">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/Filter::Util::Call">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/Filter::Util::Call">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/Filter::Util::Call">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/Filter::Util::Call">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/Filter::Util::Call">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/Filter::Util::Call">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/Filter::Util::Call">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/Filter::Util::Call">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/Filter::Util::Call">5.35.1</a>
          <a class="dropdown-item active" href="./Filter::Util::Call.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Filter::Util::Call.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="./Filter::Util::Call.html">Filter::Util::Call</a>
          <div id="more">
            (<a href="./Filter::Util::Call.txt">source</a>,
            <a href="https://metacpan.org/pod/Filter::Util::Call">CPAN</a>)
          </div>
            <div id="moduleversion">version 1.60</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#SYNOPSIS">SYNOPSIS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#DESCRIPTION">DESCRIPTION</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#use-Filter::Util::Call">use Filter::Util::Call</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#import()">import()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#filter_add()">filter_add()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#filter()-and-anonymous-sub">filter() and anonymous sub</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#LIMITATIONS">LIMITATIONS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#EXAMPLES">EXAMPLES</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#Example-1:-A-simple-filter.">Example 1: A simple filter.</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#Example-2:-Using-the-context">Example 2: Using the context</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#Example-3:-Using-the-context-within-the-filter">Example 3: Using the context within the filter</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#Example-4:-Using-filter_del">Example 4: Using filter_del</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#Filter::Simple">Filter::Simple</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#AUTHOR">AUTHOR</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#DATE">DATE</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Filter::Util::Call.html#LICENSE">LICENSE</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="./Filter::Util::Call.html#NAME">#</a>NAME</h1>

<p>Filter::Util::Call - Perl Source Filter Utility Module</p>

<h1 id="SYNOPSIS"><a class="permalink" href="./Filter::Util::Call.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<pre><code>use Filter::Util::Call ;</code></pre>

<h1 id="DESCRIPTION"><a class="permalink" href="./Filter::Util::Call.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>This module provides you with the framework to write <i>Source Filters</i> in Perl.</p>

<p>An alternate interface to Filter::Util::Call is now available. See <a href="./Filter::Simple.html">Filter::Simple</a> for more details.</p>

<p>A <i>Perl Source Filter</i> is implemented as a Perl module. The structure of the module can take one of two broadly similar formats. To distinguish between them, the first will be referred to as <i>method filter</i> and the second as <i>closure filter</i>.</p>

<p>Here is a skeleton for the <i>method filter</i>:</p>

<pre><code>package MyFilter ;

use Filter::Util::Call ;

sub import
{
    my($type, @arguments) = @_ ;
    filter_add([]) ;
}

sub filter
{
    my($self) = @_ ;
    my($status) ;

    $status = filter_read() ;
    $status ;
}

1 ;</code></pre>

<p>and this is the equivalent skeleton for the <i>closure filter</i>:</p>

<pre><code>package MyFilter ;

use Filter::Util::Call ;

sub import
{
    my($type, @arguments) = @_ ;

    filter_add(
        sub 
        {
            my($status) ;
            $status = filter_read() ;
            $status ;
        } )
}

1 ;</code></pre>

<p>To make use of either of the two filter modules above, place the line below in a Perl source file.</p>

<pre><code>use MyFilter; </code></pre>

<p>In fact, the skeleton modules shown above are fully functional <i>Source Filters</i>, albeit fairly useless ones. All they does is filter the source stream without modifying it at all.</p>

<p>As you can see both modules have a broadly similar structure. They both make use of the <code>Filter::Util::Call</code> module and both have an <code>import</code> method. The difference between them is that the <i>method filter</i> requires a <i>filter</i> method, whereas the <i>closure filter</i> gets the equivalent of a <i>filter</i> method with the anonymous sub passed to <i>filter_add</i>.</p>

<p>To make proper use of the <i>closure filter</i> shown above you need to have a good understanding of the concept of a <i>closure</i>. See <a href="perlref.html">perlref</a> for more details on the mechanics of <i>closures</i>.</p>

<h2 id="use-Filter::Util::Call"><a class="permalink" href="./Filter::Util::Call.html#use-Filter::Util::Call">#</a><a id="use"></a><b>use Filter::Util::Call</b></h2>

<p>The following functions are exported by <code>Filter::Util::Call</code>:</p>

<pre><code class="plaintext">filter_add()
filter_read()
filter_read_exact()
filter_del()</code></pre>

<h2 id="import()"><a class="permalink" href="./Filter::Util::Call.html#import()">#</a><a id="import"></a><b>import()</b></h2>

<p>The <code>import</code> method is used to create an instance of the filter. It is called indirectly by Perl when it encounters the <code>use MyFilter</code> line in a source file (See <a href="perlfunc.html#import">&quot;import&quot; in perlfunc</a> for more details on <code>import</code>).</p>

<p>It will always have at least one parameter automatically passed by Perl - this corresponds to the name of the package. In the example above it will be <code>&quot;MyFilter&quot;</code>.</p>

<p>Apart from the first parameter, import can accept an optional list of parameters. These can be used to pass parameters to the filter. For example:</p>

<pre><code>use MyFilter qw(a b c) ;</code></pre>

<p>will result in the <code>@_</code> array having the following values:</p>

<pre><code>@_ [0] =&gt; &quot;MyFilter&quot;
@_ [1] =&gt; &quot;a&quot;
@_ [2] =&gt; &quot;b&quot;
@_ [3] =&gt; &quot;c&quot;</code></pre>

<p>Before terminating, the <code>import</code> function must explicitly install the filter by calling <code>filter_add</code>.</p>

<h2 id="filter_add()"><a class="permalink" href="./Filter::Util::Call.html#filter_add()">#</a><a id="filter_add"></a><b>filter_add()</b></h2>

<p>The function, <code>filter_add</code>, actually installs the filter. It takes one parameter which should be a reference. The kind of reference used will dictate which of the two filter types will be used.</p>

<p>If a CODE reference is used then a <i>closure filter</i> will be assumed.</p>

<p>If a CODE reference is not used, a <i>method filter</i> will be assumed. In a <i>method filter</i>, the reference can be used to store context information. The reference will be <i>blessed</i> into the package by <code>filter_add</code>, unless the reference was already blessed.</p>

<p>See the filters at the end of this documents for examples of using context information using both <i>method filters</i> and <i>closure filters</i>.</p>

<h2 id="filter()-and-anonymous-sub"><a class="permalink" href="./Filter::Util::Call.html#filter()-and-anonymous-sub">#</a><a id="filter"></a><a id="filter-and-anonymous-sub"></a><b>filter() and anonymous sub</b></h2>

<p>Both the <code>filter</code> method used with a <i>method filter</i> and the anonymous sub used with a <i>closure filter</i> is where the main processing for the filter is done.</p>

<p>The big difference between the two types of filter is that the <i>method filter</i> uses the object passed to the method to store any context data, whereas the <i>closure filter</i> uses the lexical variables that are maintained by the closure.</p>

<p>Note that the single parameter passed to the <i>method filter</i>, <code>$self</code>, is the same reference that was passed to <code>filter_add</code> blessed into the filter&#39;s package. See the example filters later on for details of using <code>$self</code>.</p>

<p>Here is a list of the common features of the anonymous sub and the <code>filter()</code> method.</p>

<dl>

<dt id="$_"><a class="permalink" href="./Filter::Util::Call.html#$_">#</a><a id="pod-_"></a><b>$_</b></dt>
<dd>

<p>Although <code>$_</code> doesn&#39;t actually appear explicitly in the sample filters above, it is implicitly used in a number of places.</p>

<p>Firstly, when either <code>filter</code> or the anonymous sub are called, a local copy of <code>$_</code> will automatically be created. It will always contain the empty string at this point.</p>

<p>Next, both <code>filter_read</code> and <code>filter_read_exact</code> will append any source data that is read to the end of <code>$_</code>.</p>

<p>Finally, when <code>filter</code> or the anonymous sub are finished processing, they are expected to return the filtered source using <code>$_</code>.</p>

<p>This implicit use of <code>$_</code> greatly simplifies the filter.</p>

</dd>
<dt id="$status"><a class="permalink" href="./Filter::Util::Call.html#$status">#</a><a id="status"></a><b>$status</b></dt>
<dd>

<p>The status value that is returned by the user&#39;s <code>filter</code> method or anonymous sub and the <code>filter_read</code> and <code>read_exact</code> functions take the same set of values, namely:</p>

<pre><code class="plaintext">&lt; 0  Error
= 0  EOF
&gt; 0  OK</code></pre>

</dd>
<dt id="filter_read-and-filter_read_exact"><a class="permalink" href="./Filter::Util::Call.html#filter_read-and-filter_read_exact">#</a><a id="filter_read"></a><b>filter_read</b> and <b>filter_read_exact</b></dt>
<dd>

<p>These functions are used by the filter to obtain either a line or block from the next filter in the chain or the actual source file if there aren&#39;t any other filters.</p>

<p>The function <code>filter_read</code> takes two forms:</p>

<pre><code>$status = filter_read() ;
$status = filter_read($size) ;</code></pre>

<p>The first form is used to request a <i>line</i>, the second requests a <i>block</i>.</p>

<p>In line mode, <code>filter_read</code> will append the next source line to the end of the <code>$_</code> scalar.</p>

<p>In block mode, <code>filter_read</code> will append a block of data which is &lt;= <code>$size</code> to the end of the <code>$_</code> scalar. It is important to emphasise the that <code>filter_read</code> will not necessarily read a block which is <i>precisely</i> <code>$size</code> bytes.</p>

<p>If you need to be able to read a block which has an exact size, you can use the function <code>filter_read_exact</code>. It works identically to <code>filter_read</code> in block mode, except it will try to read a block which is exactly <code>$size</code> bytes in length. The only circumstances when it will not return a block which is <code>$size</code> bytes long is on EOF or error.</p>

<p>It is <i>very</i> important to check the value of <code>$status</code> after <i>every</i> call to <code>filter_read</code> or <code>filter_read_exact</code>.</p>

</dd>
<dt id="filter_del"><a class="permalink" href="./Filter::Util::Call.html#filter_del">#</a><b>filter_del</b></dt>
<dd>

<p>The function, <code>filter_del</code>, is used to disable the current filter. It does not affect the running of the filter. All it does is tell Perl not to call filter any more.</p>

<p>See <a href="./Filter::Util::Call.html#Example-4%3A-Using-filter_del">&quot;Example 4: Using filter_del&quot;</a> for details.</p>

</dd>
<dt id="real_import"><a class="permalink" href="./Filter::Util::Call.html#real_import">#</a><i>real_import</i></dt>
<dd>

<p>Internal function which adds the filter, based on the <a href="https://perldoc.perl.org/5.35.0/filter_add">filter_add</a> argument type.</p>

</dd>
<dt id="unimport()"><a class="permalink" href="./Filter::Util::Call.html#unimport()">#</a><a id="unimport"></a><i>unimport()</i></dt>
<dd>

<p>May be used to disable a filter, but is rarely needed. See <a href="https://perldoc.perl.org/5.35.0/filter_del">filter_del</a>.</p>

</dd>
</dl>

<h1 id="LIMITATIONS"><a class="permalink" href="./Filter::Util::Call.html#LIMITATIONS">#</a>LIMITATIONS</h1>

<p>See <a href="perlfilter.html#LIMITATIONS">&quot;LIMITATIONS&quot; in perlfilter</a> for an overview of the general problems filtering code in a textual line-level only.</p>

<dl>

<dt id="__DATA__-is-ignored"><a class="permalink" href="./Filter::Util::Call.html#__DATA__-is-ignored">#</a><a id="__DATA__"></a><a id="DATA__-is-ignored"></a>__DATA__ is ignored</dt>
<dd>

<p>The content from the __DATA__ block is not filtered. This is a serious limitation, e.g. for the <a href="Switch.html">Switch</a> module. See <a href="http://search.cpan.org/perldoc?Switch#LIMITATIONS">http://search.cpan.org/perldoc?Switch#LIMITATIONS</a> for more.</p>

</dd>
<dt id="Max.-codesize-limited-to-32-bit"><a class="permalink" href="./Filter::Util::Call.html#Max.-codesize-limited-to-32-bit">#</a><a id="Max"></a>Max. codesize limited to 32-bit</dt>
<dd>

<p>Currently internal buffer lengths are limited to 32-bit only.</p>

</dd>
</dl>

<h1 id="EXAMPLES"><a class="permalink" href="./Filter::Util::Call.html#EXAMPLES">#</a>EXAMPLES</h1>

<p>Here are a few examples which illustrate the key concepts - as such most of them are of little practical use.</p>

<p>The <code>examples</code> sub-directory has copies of all these filters implemented both as <i>method filters</i> and as <i>closure filters</i>.</p>

<h2 id="Example-1:-A-simple-filter."><a class="permalink" href="./Filter::Util::Call.html#Example-1:-A-simple-filter.">#</a><a id="Example"></a><a id="Example-1:-A-simple-filter"></a>Example 1: A simple filter.</h2>

<p>Below is a <i>method filter</i> which is hard-wired to replace all occurrences of the string <code>&quot;Joe&quot;</code> to <code>&quot;Jim&quot;</code>. Not particularly Useful, but it is the first example and I wanted to keep it simple.</p>

<pre><code>package Joe2Jim ;

use Filter::Util::Call ;

sub import
{
    my($type) = @_ ;

    filter_add(bless []) ;
}

sub filter
{
    my($self) = @_ ;
    my($status) ;

    s/Joe/Jim/g
        if ($status = filter_read()) &gt; 0 ;
    $status ;
}

1 ;</code></pre>

<p>Here is an example of using the filter:</p>

<pre><code>use Joe2Jim ;
print &quot;Where is Joe?\n&quot; ;</code></pre>

<p>And this is what the script above will print:</p>

<pre><code class="plaintext">Where is Jim?</code></pre>

<h2 id="Example-2:-Using-the-context"><a class="permalink" href="./Filter::Util::Call.html#Example-2:-Using-the-context">#</a><a id="Example1"></a>Example 2: Using the context</h2>

<p>The previous example was not particularly useful. To make it more general purpose we will make use of the context data and allow any arbitrary <i>from</i> and <i>to</i> strings to be used. This time we will use a <i>closure filter</i>. To reflect its enhanced role, the filter is called <code>Subst</code>.</p>

<pre><code>package Subst ;

use Filter::Util::Call ;
use Carp ;

sub import
{
    croak(&quot;usage: use Subst qw(from to)&quot;)
        unless @_ == 3 ;
    my ($self, $from, $to) = @_ ;
    filter_add(
        sub 
        {
            my ($status) ;
            s/$from/$to/
                if ($status = filter_read()) &gt; 0 ;
            $status ;
        })
}
1 ;</code></pre>

<p>and is used like this:</p>

<pre><code>use Subst qw(Joe Jim) ;
print &quot;Where is Joe?\n&quot; ;</code></pre>

<h2 id="Example-3:-Using-the-context-within-the-filter"><a class="permalink" href="./Filter::Util::Call.html#Example-3:-Using-the-context-within-the-filter">#</a><a id="Example2"></a>Example 3: Using the context within the filter</h2>

<p>Here is a filter which a variation of the <code>Joe2Jim</code> filter. As well as substituting all occurrences of <code>&quot;Joe&quot;</code> to <code>&quot;Jim&quot;</code> it keeps a count of the number of substitutions made in the context object.</p>

<p>Once EOF is detected (<code>$status</code> is zero) the filter will insert an extra line into the source stream. When this extra line is executed it will print a count of the number of substitutions actually made. Note that <code>$status</code> is set to <code>1</code> in this case.</p>

<pre><code>    package Count ;

    use Filter::Util::Call ;

    sub filter
    {
        my ($self) = @_ ;
        my ($status) ;

        if (($status = filter_read()) &gt; 0 ) {
            s/Joe/Jim/g ;
	    ++ $$self ;
        }
	elsif ($$self &gt;= 0) { # EOF
            $_ = &quot;print q[Made ${$self} substitutions\n]&quot; ;
            $status = 1 ;
	    $$self = -1 ;
        }

        $status ;
    }

    sub import
    {
        my ($self) = @_ ;
        my ($count) = 0 ;
        filter_add(\$count) ;
    }

    1 ;</code></pre>

<p>Here is a script which uses it:</p>

<pre><code>use Count ;
print &quot;Hello Joe\n&quot; ;
print &quot;Where is Joe\n&quot; ;</code></pre>

<p>Outputs:</p>

<pre><code class="plaintext">Hello Jim
Where is Jim
Made 2 substitutions</code></pre>

<h2 id="Example-4:-Using-filter_del"><a class="permalink" href="./Filter::Util::Call.html#Example-4:-Using-filter_del">#</a><a id="Example3"></a>Example 4: Using filter_del</h2>

<p>Another variation on a theme. This time we will modify the <code>Subst</code> filter to allow a starting and stopping pattern to be specified as well as the <i>from</i> and <i>to</i> patterns. If you know the <i>vi</i> editor, it is the equivalent of this command:</p>

<pre><code class="plaintext">:/start/,/stop/s/from/to/</code></pre>

<p>When used as a filter we want to invoke it like this:</p>

<pre><code>use NewSubst qw(start stop from to) ;</code></pre>

<p>Here is the module.</p>

<pre><code>package NewSubst ;

use Filter::Util::Call ;
use Carp ;

sub import
{
    my ($self, $start, $stop, $from, $to) = @_ ;
    my ($found) = 0 ;
    croak(&quot;usage: use Subst qw(start stop from to)&quot;)
        unless @_ == 5 ;

    filter_add( 
        sub 
        {
            my ($status) ;

            if (($status = filter_read()) &gt; 0) {

                $found = 1
                    if $found == 0 and /$start/ ;

                if ($found) {
                    s/$from/$to/ ;
                    filter_del() if /$stop/ ;
                }

            }
            $status ;
        } )

}

1 ;</code></pre>

<h1 id="Filter::Simple"><a class="permalink" href="./Filter::Util::Call.html#Filter::Simple">#</a><a id="Filter"></a>Filter::Simple</h1>

<p>If you intend using the Filter::Call functionality, I would strongly recommend that you check out Damian Conway&#39;s excellent Filter::Simple module. Damian&#39;s module provides a much cleaner interface than Filter::Util::Call. Although it doesn&#39;t allow the fine control that Filter::Util::Call does, it should be adequate for the majority of applications. It&#39;s available at</p>

<pre><code class="plaintext">http://search.cpan.org/dist/Filter-Simple/</code></pre>

<h1 id="AUTHOR"><a class="permalink" href="./Filter::Util::Call.html#AUTHOR">#</a>AUTHOR</h1>

<p>Paul Marquess</p>

<h1 id="DATE"><a class="permalink" href="./Filter::Util::Call.html#DATE">#</a>DATE</h1>

<p>26th January 1996</p>

<h1 id="LICENSE"><a class="permalink" href="./Filter::Util::Call.html#LICENSE">#</a>LICENSE</h1>

<p>Copyright (c) 1995-2011 Paul Marquess. All rights reserved. Copyright (c) 2011-2014 Reini Urban. All rights reserved. Copyright (c) 2014-2017 cPanel Inc. All rights reserved.</p>

<p>This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
